from flask import render_template, url_for
from blueprint import page_bp


@page_bp.route('/login', methods=['GET'])
def login():
    return render_template('login/login.html',
                           url_for_register_page=url_for('page.register'),
                           url_for_login_service=url_for('login'),
                           url_for_user_success_page=url_for('page.user_index'),
                           url_for_admin_success_page=url_for('page.admin_index')
                           )

@page_bp.route('/register', methods=['GET'])
def register():
    return render_template('login/register.html',
                           url_for_login_page=url_for('page.login'),
                           url_for_register_service=url_for('register'))

@page_bp.route('/user/index', methods=['GET'])
def user_index():
    return render_template('front/page/home.html')

@page_bp.route('/admin/index', methods=['GET'])
def admin_index():
    return render_template('back/page/first_page.html')

@page_bp.route('/blog/hot', methods=['GET'])
def blog_hot():
    return render_template('front/page/blog/hot_page.html')

@page_bp.route('/blog/recent', methods=['GET'])
def blog_recent():
    return render_template('front/page/blog/recent_page.html')

@page_bp.route('/blog/sort/make_friends', methods=['GET'])
def blog_make_friends():
    return render_template('front/page/blog/make_friends_page.html', )

@page_bp.route('/blog/sort/help', methods=['GET'])
def blog_help():
    return  render_template('front/page/blog/help_page.html')

@page_bp.route('/blog/sort/trade', methods=['GET'])
def blog_trade():
    return render_template('front/page/blog/trade_page.html')

#TODO
@page_bp.route('/blog/my/following', methods=['GET'])
def blog_my_following():
    return render_template('front/page/blog/follow_page.html')

@page_bp.route('/blog/similar', methods=['GET'])
def blog_similar():
    return render_template('front/page/blog/similar_page.html')

@page_bp.route('/blog/detail/<int:pid>', methods=['GET'])
def blog_detail(pid):
    # 其他逻辑
    return render_template('front/page/blog/detail_page.html', pid=pid)

